package com.Fh.enum_;
//展示自定义枚举
public class enumeration02 {
    public static void main(String[] args) {
        System.out.println(Enum02.SPRING);
        System.out.println(Enum02.SUMMER);
        System.out.println(Enum02.AUTUMN);
        System.out.println(Enum02.WINTER);
        //在主方法中无法进行new的操作

    }
}
class Enum02 {
    private String name;
    private String description;
    //技巧：通过 static+final 可以避免类的加载，实现底层优化
    public static final Enum02 SPRING = new Enum02("春天","温暖");
    public static final Enum02 SUMMER = new Enum02("夏天","炎热");
    public static final Enum02 AUTUMN = new Enum02("秋天","凉爽");
    public static final Enum02 WINTER = new Enum02("冬天","寒冷");
    //使构造器私有化，无法进行创建对象的操作
    private Enum02(String name,String description) {
        this.name = name;
        this.description = description;
    }
    public String getName() {
        return name;
    }
    public String getDescription() {
        return description;
    }
    //去除set方法，防止信息被修改

    @Override
    public String toString() {
        return "Enum01{" +
                "description='" + description + '\'' +
                ", name='" + name + '\'' +
                '}';
    }
}
